package cn.itcast.clients;

import cn.itcast.clients.fullback.UserFeignApiFallBack;
import cn.itcast.pojo.User;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.context.annotation.Primary;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

/**
 * @author dejawu
 * @Title: UserFeignApi
 * @Description: TODO
 * @date 2021/1/3
 */
@FeignClient(value = "user-service",fallback = UserFeignApiFallBack.class)
//@FeignClient("user-service")
@Primary    //如果当前容器中存在了同类型的bean，可以用primary来指定优先加载哪个
public interface UserFeignApi {

    @GetMapping("/user/{id}")
    User findById(@PathVariable("id")String username);
}